//
//  SDCycleScrollView.h
//  SDCycleScrollView
//
//  Created by aier on 15-3-22.
//  Copyright (c) 2015年 GSD. All rights reserved.
//

/**
 
 *******************************************************
 *                                                      *
 * 感谢您的支持， 如果下载的代码在使用过程中出现BUG或者其他问题    *
 * 您可以发邮件到gsdios@126.com 或者 到                       *
 * https://github.com/gsdios?tab=repositories 提交问题     *
 *                                                      *
 *******************************************************
 
 //情景一：采用本地图片实现
 NSArray *images = @[[NSDictionary dictionaryWithObjectsAndKeys: [UIImage imageNamed:@"h1.jpg"],@"image",@"这是标题",@"title",@"1",@"id", nil],
 [NSDictionary dictionaryWithObjectsAndKeys: [UIImage imageNamed:@"h2.jpg"],@"image",@"这是标题",@"title",@"2",@"id", nil],
 [NSDictionary dictionaryWithObjectsAndKeys: [UIImage imageNamed:@"h3.jpg"],@"image",@"这是标题",@"title",@"3",@"id", nil],
 [NSDictionary dictionaryWithObjectsAndKeys: [UIImage imageNamed:@"h4.jpg"],@"image",@"这是标题",@"title",@"4",@"id", nil]];
 
 
 // 情景二：采用网络图片实现
 NSArray *imagesURLStrings =@[
 [NSDictionary dictionaryWithObjectsAndKeys:@"https://ss2.baidu.com/-vo3dSag_xI4khGko9WTAnF6hhy/super/whfpf%3D425%2C260%2C50/sign=a4b3d7085dee3d6d2293d48b252b5910/0e2442a7d933c89524cd5cd4d51373f0830200ea.jpg",@"image",@"这是标题",@"title",@"1",@"id", nil],
 [NSDictionary dictionaryWithObjectsAndKeys: @"https://ss0.baidu.com/-Po3dSag_xI4khGko9WTAnF6hhy/super/whfpf%3D425%2C260%2C50/sign=a41eb338dd33c895a62bcb3bb72e47c2/5fdf8db1cb134954a2192ccb524e9258d1094a1e.jpg",@"image",@"这是标题",@"title",@"2",@"id", nil],
 [NSDictionary dictionaryWithObjectsAndKeys:  @"http://c.hiphotos.baidu.com/image/w%3D400/sign=c2318ff84334970a4773112fa5c8d1c0/b7fd5266d0160924c1fae5ccd60735fae7cd340d.jpg",@"image",@"这是标题",@"title",@"3",@"id", nil]];
 
 
 
 
 
 
 CGFloat w = self.view.bounds.size.width;
 
 // 本地加载 --- 创建不带标题的图片轮播器
 SDCycleScrollView *cycleScrollView = [SDCycleScrollView cycleScrollViewWithFrame:CGRectMake(0, 100, w, 180) imagesGroup:images];
 
 cycleScrollView.infiniteLoop = YES;
 cycleScrollView.delegate = self;
 cycleScrollView.pageControlStyle = SDCycleScrollViewPageContolStyleAnimated;
 [self.view addSubview:cycleScrollView];
 //             --- 轮播时间间隔，默认1.0秒，可自定义
 //    cycleScrollView.autoScrollTimeInterval = 4.0;
 
 //网络加载 --- 创建带标题的图片轮播器
 SDCycleScrollView *cycleScrollView2 = [SDCycleScrollView cycleScrollViewWithFrame:CGRectMake(0, 320, w, 180) imageURLStringsGroup:nil]; // 模拟网络延时情景
 cycleScrollView2.pageControlAliment = SDCycleScrollViewPageContolAlimentRight;
 cycleScrollView2.delegate = self;
 cycleScrollView2.isShowTitle=YES;
 cycleScrollView2.dotColor = [UIColor yellowColor]; // 自定义分页控件小圆标颜色
 cycleScrollView2.placeholderImage = [UIImage imageNamed:@"placeholder"];
 [self.view addSubview:cycleScrollView2];
 
 //             --- 模拟加载延迟
 dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
 cycleScrollView2.imageURLStringsGroup = imagesURLStrings;
 });
 
 */


#import <UIKit/UIKit.h>

typedef enum {
    SDCycleScrollViewPageContolAlimentRight,
    SDCycleScrollViewPageContolAlimentCenter
} SDCycleScrollViewPageContolAliment;

typedef enum {
    SDCycleScrollViewPageContolStyleClassic,        // 系统自带经典样式
    SDCycleScrollViewPageContolStyleAnimated,       // 动画效果pagecontrol
    SDCycleScrollViewPageContolStyleNone            // 不显示pagecontrol
} SDCycleScrollViewPageContolStyle;

@class SDCycleScrollView;

@protocol SDCycleScrollViewDelegate <NSObject>

- (void)cycleScrollView:(SDCycleScrollView *)cycleScrollView didSelectItemAtIndex:(NSInteger)index selectDict:(NSDictionary*)Dict IsBanner:(BOOL)isBanner;

@end

@interface SDCycleScrollView : UIView




// 本地图片数组
@property (nonatomic, strong) NSArray *localizationImagesGroup;

// 网络图片 url string 数组
@property (nonatomic, strong) NSArray *imageURLStringsGroup;
// 网络图片 url string 数组
@property (nonatomic, strong) NSArray *typeGroup;


// 是否显示文字
@property (nonatomic) BOOL isShowTitle;

// 是否动态显示文字
@property (nonatomic) BOOL isDynamicShowTitle;

// 是否是首页的分类
@property (nonatomic) BOOL isKLYType;

// >>>>>>>>>>>>>>>>>>>>>>>>>  滚动控制接口

// 自动滚动间隔时间,默认2s
@property (nonatomic, assign) CGFloat autoScrollTimeInterval;

// 是否无限循环,默认Yes
@property(nonatomic,assign) BOOL infiniteLoop;

// 是否自动滚动,默认Yes
@property(nonatomic,assign) BOOL autoScroll;

@property (nonatomic, weak) id<SDCycleScrollViewDelegate> delegate;




// >>>>>>>>>>>>>>>>>>>>>>>>>  自定义样式接口

// 是否显示分页控件
@property (nonatomic, assign) BOOL showPageControl;

// 是否在只有一张图时隐藏pagecontrol，默认为YES
@property(nonatomic) BOOL hidesForSinglePage;

// pagecontrol 样式，默认为动画样式
@property (nonatomic, assign) SDCycleScrollViewPageContolStyle pageControlStyle;

// 占位图，用于网络未加载到图片时
@property (nonatomic, strong) UIImage *placeholderImage;

// 分页控件位置
@property (nonatomic, assign) SDCycleScrollViewPageContolAliment pageControlAliment;

// 分页控件小圆标大小
@property (nonatomic, assign) CGSize pageControlDotSize;

// 分页控件小圆标颜色
@property (nonatomic, strong) UIColor *dotColor;

@property (nonatomic, strong) UIColor *titleLabelTextColor;
@property (nonatomic, strong) UIFont  *titleLabelTextFont;
@property (nonatomic, strong) UIColor *titleLabelBackgroundColor;
@property (nonatomic, assign) CGFloat titleLabelHeight;





+ (instancetype)cycleScrollViewWithFrame:(CGRect)frame imagesGroup:(NSArray *)imagesGroup;

+ (instancetype)cycleScrollViewWithFrame:(CGRect)frame imageURLStringsGroup:(NSArray *)imageURLStringsGroup;


+ (instancetype)cycleScrollViewWithFrame:(CGRect)frame TypeGroup:(NSArray *)typeGroup;

@end
